<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改联系人信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-edit" th:object="${contactInfo}">
            <input name="contactId" th:field="*{contactId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">联系人姓名：</label>
                    <div class="col-sm-8">
                        <input name="contactName" th:field="*{contactName}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">手机号码：</label>
                    <div class="col-sm-8">
                        <input name="phone" th:field="*{phone}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">电子邮箱：</label>
                    <div class="col-sm-8">
                        <input name="email" th:field="*{email}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">联系地址：</label>
                    <div class="col-sm-8">
                        <input name="address" th:field="*{address}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">公司名称：</label>
                    <div class="col-sm-8">
                        <input name="company" th:field="*{company}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">职位：</label>
                    <div class="col-sm-8">
                        <input name="jobTitle" th:field="*{jobTitle}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">生日：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="birthday" th:value="${#dates.format(contactInfo.birthday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">分类ID：</label>
                    <div class="col-sm-8">
                        <select id="categoryId" name="categoryId" th:field="*{categoryId}" class="from-control" required>
                            <option value="">--请选择分类--</option>
                            <option th:each="category : ${categories}"
                                    th:value="${category.categoryId}"
                                    th:text="${category.categoryName}">
                            </option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">重要等级：</label>
                    <div class="col-sm-8">
                        <select id="levelId" name="levelId" th:field="*{levelId}" class="from-control" required>
                            <option value="">-- 请选择等级 --</option>
                            <option th:each="level : ${leveles}"
                                    th:value="${level.levelId}"
                                    th:text="${level.levelName}">
                            </option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "contact/info";
        $("#form-info-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-info-edit').serialize());
            }
        }

        $("input[name='birthday']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>